package crivia.ecp.carry.eb;

import crivia.ecp.common.ECR;

public class MoreMenu {
	
	private String name;
	public String getName() {
		return name;
	}
	public MoreMenu setName(String name) {
		this.name = name;
		return this;
	}
	
	private String href;
	public String getHref() {
		return href;
	}
	public String getScriptMethod(){
		String[] ss = href.split(":");
		if (ss.length == 1){
			return "";
		}
		return ss[1];
	}
	public MoreMenu setHref(String href) {
		this.href = href;
		return this;
	}
	
	private String target;
	public String getTarget() {
		return target;
	}
	public MoreMenu setTarget(String target) {
		this.target = target;
		return this;
	}
	
	private boolean inTop = false;
	public MoreMenu setInTop(boolean inTop) {
		this.inTop = inTop;
		return this;
	}
	public boolean isInTop() {
		return inTop;
	}

	public MoreMenu() {
		super();
	}

	public MoreMenu(String name, String href) {
		super();
		this.name = name;
		this.href = href;
		this.target = ECR.Target_Self;
	}

	public MoreMenu(String name, String href, String target) {
		super();
		this.name = name;
		this.href = href;
		this.target = target;
	}
	
	@Override
	public String toString() {
		StringBuilder tStr = new StringBuilder("{ ");
		tStr.append(name);
		tStr.append(" ,");
		tStr.append(ECR.ns(href)
			.replaceAll("\"", "\\\\\""));
		tStr.append(" ,");
		tStr.append(target);
		tStr.append(" }");
		return tStr.toString();
	}

}
